package com.wuseguang.springcloud.controller;


import com.wuseguang.springcloud.Filter.RequestParameterWrapper;
import com.wuseguang.springcloud.entity.EvaluationLabel;
import com.wuseguang.springcloud.entity.Teacher;
import com.wuseguang.springcloud.service.EvaluationLabelService;
import com.wuseguang.springcloud.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 学校评价标签表 前端控制器
 * </p>
 *
 * @author 
 * @since 2020-02-02
 */
@RestController
@RequestMapping("/evaluationLabel")
public class EvaluationLabelController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private EvaluationLabelService evaluationLabelServiceImpl;

    /**
     * 添加评价标签
     * @param request
     * @param evaluationLabel
     * @return
     */
    @RequestMapping("/addEvaluationLabel")
    public Result addEvaluationLabel(RequestParameterWrapper request,  EvaluationLabel evaluationLabel){


        logger.info("添加学校标签");
        //获取学校id
        String schoolId = request.getParam("schoolId");
        evaluationLabel.setSchoolId(Integer.valueOf(schoolId));

        return evaluationLabelServiceImpl.addEvaluationLabel(evaluationLabel);
    }

    /**
     * 查询学校标签
     * @param request
     * @return
     */
    @RequestMapping("/findEvaluationLabel")
    public Result findEvaluationLabel(RequestParameterWrapper request){
        logger.info("查询学校标签");
        //获取学校id
        String schoolId = request.getParam("schoolId");

        return evaluationLabelServiceImpl.findEvaluationLabel(schoolId);
    }

    /**
     * 删除学校评价标签
     * @param request
     * @param id
     * @return
     */
    @RequestMapping("/deleteEvaluationLabel")
    public Result deleteEvaluationLabel(RequestParameterWrapper request,@RequestParam("id") Integer id){
        logger.info("删除学校评价标签");
        return evaluationLabelServiceImpl.deleteEvaluationLabel(id);
    }

}

